package cn.piggy.gateway.core.proxy.reference;

import cn.piggy.gateway.core.executor.result.SessionResult;
import cn.piggy.gateway.core.proxy.MethodIntercept;
import cn.piggy.gateway.core.proxy.MyGenericReference;
import cn.piggy.gateway.core.session.GatewaySession;

import java.util.Map;

public class MyGenericReferenceImpl implements MyGenericReference {

    private final GatewaySession session;

    public MyGenericReferenceImpl(GatewaySession session){
        this.session = session;
    }

    @Override
    public SessionResult $invoke(Map<String, Object> params) {
        MethodIntercept linkMethod = new MethodIntercept(session, params);
        return (SessionResult)linkMethod.execute();
    }
}
